<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,user-scalable=no">
    <meta name="Keywords" content=" ">
    <meta name="copyright" content=" ">
    <meta name="Description" content=" ">
    <title>weixin://private/setresult/SCENE_FETCHQUEUE&amp;eyJmdW5jIjoibG9nIiwicGFyYW1zIjp7Im1zZyI6Il9ydW5PbjNyZEFwaUxpc3QgOiBtZW51OnNoYXJlOnRpbWVsaW5lLG1lbnU6c2hhcmU6YXBwbWVzc2FnZSxvblZvaWNlUmVjb3JkRW5kLG9uVm9pY2VQbGF5QmVnaW4sb25Wb2ljZVBsYXlFbmQsb25Mb2NhbEltYWdlVXBsb2FkUHJvZ3Jlc3Msb25JbWFnZURvd25sb2FkUHJvZ3Jlc3Msb25Wb2ljZVVwbG9hZFByb2dyZXNzLG9uVm9pY2VEb3dubG9hZFByb2dyZXNzLG1lbnU6c2V0Zm9udCxtZW51OnNoYXJlOndlaWJvLG1lbnU6c2hhcmU6ZW1haWwsd3hkb3dubG9hZDpzdGF0ZV9jaGFuZ2UsaGRPbkRldmljZVN0YXRlQ2hhbmdlZCxhY3Rpdml0eTpzdGF0ZV9jaGFuZ2UifSwiX19tc2dfdHlwZSI6ImNhbGwiLCJfX2NhbGxiYWNrX2lkIjoiMTAwMSJ9</title>
    <link rel="stylesheet" href="../css/iconfont.css">
    <link rel="stylesheet" href="../css/style.css">
    <link rel="stylesheet" href="../css/sign.css">
    <script type="text/javascript" src="../js/jquery.js"></script>
    <script type="text/javascript" src="../js/TouchSlide.js"></script>
    <script src="../js/jweixin.js"></script>
    <link rel="stylesheet" href="../css/layer.css" id="layui_layer_skinlayercss">
</head>
<body>

<div class="container">
    <div class="header">
        <div class="banner">
            <img src="../img/112508wnaiuxc8vvfgeeoz.gif?response-content-type=image/gif">
        </div>
        <div class="bannerFugai"><img src="../img/bannerFugai.png"></div>
    </div>

    <div class="cont">
        <h2 class="t1 t2 tc">已累计签到 <span class="signTime">1</span>天</h2>
        <p class="calendarBtn"><i class="icon iconfont iconSize">󰋣</i> 签到日历</p>
        <div id="calendar">
            <div class="sign_main" id="sign_layer">
                <div class="sign_succ_calendar_title">
                    <div class="calendar_month_next"><i class="icon iconfont calendarColor">󰊯</i></div>
                    <div class="calendar_month_prev"><i class="icon iconfont calendarColor">󰊒</i></div>
                    <div class="calendar_month_span">2016年4月</div>
                </div>
                <div class="sign" id="sign_cal">
                    <table>
                        <thead>
                        <tr>
                            <th>周日</th>
                            <th>周一</th>
                            <th>周二</th>
                            <th>周三</th>
                            <th>周四</th>
                            <th>周五</th>
                            <th>周六</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr>
                            <td> </td>
                            <td> </td>
                            <td> </td>
                            <td> </td>
                            <td> </td>
                            <td>1</td>
                            <td>2</td>
                        </tr>
                        <tr>
                            <td>3</td>
                            <td>4</td>
                            <td>5</td>
                            <td>6</td>
                            <td>7</td>
                            <td><span class="on">8</span></td>
                            <td>9</td>
                        </tr>
                        <tr>
                            <td>10</td>
                            <td>11</td>
                            <td>12</td>
                            <td>13</td>
                            <td>14</td>
                            <td>15</td>
                            <td>16</td>
                        </tr>
                        <tr>
                            <td>17</td>
                            <td>18</td>
                            <td>19</td>
                            <td>20</td>
                            <td>21</td>
                            <td>22</td>
                            <td>23</td>
                        </tr>
                        <tr>
                            <td>24</td>
                            <td>25</td>
                            <td>26</td>
                            <td>27</td>
                            <td>28</td>
                            <td>29</td>
                            <td>30</td>
                        </tr>
                        <tr>
                            <td> </td>
                            <td> </td>
                            <td> </td>
                            <td> </td>
                            <td> </td>
                            <td> </td>
                            <td> </td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>

        <div class="form">
            <div class="controls">
                <div class="btnBorder-1">
                    <a href="javascript:;" id="sign" class="btn btnDisabled">今日已签到</a>
                </div>
            </div>
        </div>

        <div class="signCont">
            <ul>
                <li>
                    <span> 领取现金 <img src="../img/flowIcon.png"> 0.5 </span>
                    <a href="javascript:;" class="signBtn signBtn1">已领取</a>
                </li>
                <li>
                    <span> 领取现金 <img src="../img/flowIcon.png"> 1 </span>
                    <a href="javascript:;" class="signBtn signBtn2 ">领取</a>
                </li>
                <li>
                    <span> 领取现金 <img src="../img/flowIcon.png"> 2 </span>
                    <a href="javascript:;" class="signBtn signBtn2 signBtnDisabled">还需9天</a>
                </li>
                <li>
                    <span> 领取现金 <img src="../img/flowIcon.png"> 3 </span>
                    <a href="javascript:;" class="signBtn signBtn2 signBtnDisabled">还需19天</a>
                </li>
                <li>
                    <span> 领取现金 <img src="../img/flowIcon.png"> 5 </span>
                    <a href="javascript:;" class="signBtn signBtn2 signBtnDisabled">还需29天</a>
                </li>
                <li>
                    <span>签到总收益：<img src="../img/flowIcon.png"> <span class="user-money">2</span>(<span class="user-money">12</span>元) </span>
                    <a href="http://m.ifengcu.com/ucenter/login?mobile=15804245732" class="signBtn signBtn3">立即兑换</a>
                </li>
            </ul>
        </div>
        <p class="guizeBtn tc"><a href="/sign/57072761044aa85a55080841/index?dodesc=1">活动规则</a></p>
    </div>
    <script type="text/javascript">


        var calUtil = {
            //当前日历显示的年份
            showYear:2016,
            //当前日历显示的月份
            showMonth:04,
            //当前日历显示的天数
            showDays:08,
            eventName:"load",

            lastMonth:04,
            lastYear:2016,
            nextMonth:04,
            nextYear:2016,

            //初始化日历
            init:function(signList){
                calUtil.setMonthAndDay();
                calUtil.draw(signList);
                calUtil.bindEnvent();
            },

            draw:function(signList){
                //绑定日历
                var str = calUtil.drawCal(calUtil.showYear,calUtil.showMonth,signList);
                $("#calendar").html(str);
                //绑定日历表头
                var calendarName=calUtil.showYear+"年"+calUtil.showMonth+"月";
                $(".calendar_month_span").html(calendarName);
            },

            bindEnvent:function(){
                //绑定上个月事件
                $(".calendar_month_prev").click(function(){
                    //ajax获取日历json数据
                    calUtil.getSignList(calUtil.showYear, calUtil.showMonth, 'prev');
                });

                //绑定下个月事件
                $(".calendar_month_next").click(function(){
                    calUtil.getSignList(calUtil.showYear, calUtil.showMonth, 'next');
                });
            },

            getSignList:function(getYear, getMonth, eventName){

                $.ajax({
                    url: '/sign/57072761044aa85a55080841/index?dogetdays=1',
                    type: 'post',
                    dataType: 'json',
                    data: {year: getYear, month:getMonth, type:eventName},
                    'success': function (resp) {
                        if (resp.error == 0) {
                            calUtil.eventName = eventName;
                            calUtil.init(resp.signdays);
                        } else {
                            var message = "提交失败,错误如下:<br />";
                            message = message + resp.message.join("<br />");
                            layer.alert(message, {icon: 2});
                        }
                    }
                });

            },

            //获取当前选择的年月
            setMonthAndDay:function(){
                switch(calUtil.eventName)
                {
                    case "load":
                        var current = new Date();
                        calUtil.showYear  = current.getFullYear();
                        calUtil.showMonth = current.getMonth() + 1;
                        break;

                    case "prev":
                        var nowMonth=$(".calendar_month_span").html().split("年")[1].split("月")[0];
                        calUtil.showMonth=parseInt(nowMonth)-1;
                        if(calUtil.showMonth==0)
                        {
                            calUtil.showMonth=12;
                            calUtil.showYear-=1;
                        }
                        break;
                    case "next":
                        var nowMonth=$(".calendar_month_span").html().split("年")[1].split("月")[0];
                        calUtil.showMonth=parseInt(nowMonth)+1;
                        if(calUtil.showMonth==13)
                        {
                            calUtil.showMonth=1;
                            calUtil.showYear+=1;
                        }
                        break;
                }
            },
            getDaysInmonth : function(iMonth, iYear){
                var dPrevDate = new Date(iYear, iMonth, 0);
                return dPrevDate.getDate();
            },
            bulidCal : function(iYear, iMonth) {
                var aMonth = new Array();
                aMonth[0] = new Array(7);
                aMonth[1] = new Array(7);
                aMonth[2] = new Array(7);
                aMonth[3] = new Array(7);
                aMonth[4] = new Array(7);
                aMonth[5] = new Array(7);
                aMonth[6] = new Array(7);
                var dCalDate = new Date(iYear, iMonth - 1, 1);
                var iDayOfFirst = dCalDate.getDay();
                var iDaysInMonth = calUtil.getDaysInmonth(iMonth, iYear);
                var iVarDate = 1;
                var d, w;
                aMonth[0][0] = "周日";
                aMonth[0][1] = "周一";
                aMonth[0][2] = "周二";
                aMonth[0][3] = "周三";
                aMonth[0][4] = "周四";
                aMonth[0][5] = "周五";
                aMonth[0][6] = "周六";
                for (d = iDayOfFirst; d < 7; d++) {
                    aMonth[1][d] = iVarDate;
                    iVarDate++;
                }
                for (w = 2; w < 7; w++) {
                    for (d = 0; d < 7; d++) {
                        if (iVarDate <= iDaysInMonth) {
                            aMonth[w][d] = iVarDate;
                            iVarDate++;
                        }
                    }
                }
                return aMonth;
            },
            ifHasSigned : function(signList,day){
                var signed = false;
                $.each(signList,function(index,item){
                    if(item.signDay == day) {
                        signed = true;
                        return false;
                    }
                });
                return signed ;
            },
            drawCal : function(iYear, iMonth ,signList) {
                var myMonth = calUtil.bulidCal(iYear, iMonth);
                var htmls = new Array();
                htmls.push("<div class='sign_main' id='sign_layer'>");
                htmls.push("<div class='sign_succ_calendar_title'>");
                htmls.push("<div class='calendar_month_next'><i class='icon iconfont calendarColor'>&#xf02af;</i></div>");
                htmls.push("<div class='calendar_month_prev'><i class='icon iconfont calendarColor'>&#xf0292;</i></div>");
                htmls.push("<div class='calendar_month_span'></div>");
                htmls.push("</div>");
                htmls.push("<div class='sign' id='sign_cal'>");
                htmls.push("<table>");
                htmls.push("<thead>");
                htmls.push("<tr>");
                htmls.push("<th>" + myMonth[0][0] + "</th>");
                htmls.push("<th>" + myMonth[0][1] + "</th>");
                htmls.push("<th>" + myMonth[0][2] + "</th>");
                htmls.push("<th>" + myMonth[0][3] + "</th>");
                htmls.push("<th>" + myMonth[0][4] + "</th>");
                htmls.push("<th>" + myMonth[0][5] + "</th>");
                htmls.push("<th>" + myMonth[0][6] + "</th>");
                htmls.push("</tr>");
                htmls.push("</thead>");
                var d, w;
                for (w = 1; w < 7; w++) {
                    htmls.push("<tr>");
                    for (d = 0; d < 7; d++) {
                        var ifHasSigned = calUtil.ifHasSigned(signList,myMonth[w][d]);
                        //console.log(ifHasSigned);
                        if(ifHasSigned){
                            htmls.push("<td>"+"<span class='on'>" + (!isNaN(myMonth[w][d]) ? myMonth[w][d] : " ")+"</span>" + "</td>");
                        } else {
                            htmls.push("<td>" + (!isNaN(myMonth[w][d]) ? myMonth[w][d] : " ") + "</td>");
                        }
                    }
                    htmls.push("</tr>");
                }
                htmls.push("</table>");
                htmls.push("</div>");
                htmls.push("</div>");
                return htmls.join('');
            }
        };

        $(function(){
            //ajax获取日历json数据
            var signList= [{"signDay":8}];
            calUtil.init(signList);

            $('.calendarBtn').on('click', function(){
                $("#calendar").slideToggle(200);
            });

            $('.do-signin').click(function() {
                var thisObj = $(this);
                if (thisObj.hasClass('doing')) return false;

                thisObj.addClass('doing');

                $.ajax({
                    'url':'/sign/57072761044aa85a55080841/index?dosignin=1',
                    'type': 'post',
                    'data': {},
                    'dataType': 'json',
                    'async' : true,
                    'success': function (resp) {
                        if (resp.error == 1) {
                            parent.layer.msg(resp.message.join('|'), {time: 3000});
                            thisObj.removeClass('doing');
                            return true;
                        } else {
                            window.location.href = "/sign/57072761044aa85a55080841/index";
                            return true;
                        }
                    },

                    'error':function(request, error){
                        thisObj.removeClass('doing');
                        parent.layer.msg('Sorry,服务器病了~请稍候再试~', {time: 3000});
                    }

                });

            });


            $('.do-getPrize').click(function() {
                var thisObj = $(this);
                var day  = thisObj.attr('data-day');
                if (thisObj.hasClass('doing')) return false;

                thisObj.addClass('doing');

                $.ajax({
                    'url':'/sign/57072761044aa85a55080841/index?dogetprize=1',
                    'type': 'post',
                    'data': {day:day},
                    'dataType': 'json',
                    'async' : true,
                    'success': function (resp) {
                        if (resp.error == 1) {
                            parent.layer.msg(resp.message.join('|'), {time: 3000});
                            thisObj.removeClass('doing');
                            return true;
                        } else {
                            window.location.href = "/sign/57072761044aa85a55080841/index?getprize=1";
                            return true;
                        }
                    },

                    'error':function(request, error){
                        thisObj.removeClass('doing');
                        parent.layer.msg('Sorry,服务器病了~请稍候再试~', {time: 3000});
                    }

                });

            });


        });
    </script>


    <script type="text/javascript">
        <!--
        wx.config({
            debug: false,
            appId: 'wx591f8a0ee3ed8caf',
            timestamp: 1460091595,
            nonceStr: 'exAtMEEH1I2lK6SK',
            signature: '09c121ec17b7d1bba3162e4ebe16f6fb546aeb9d',
            jsApiList: ['hideOptionMenu','onMenuShareTimeline','onMenuShareAppMessage', 'showMenuItems']
        });


        wx.ready(function () {
            wx.hideOptionMenu();
        });

        //-->
    </script>
    <script type="text/javascript" src="../js/func.js"></script>
    <script type="text/javascript" src="../js/jquery.validate.js"></script>
    <script type="text/javascript" src="../js/layer.js"></script>

</div>

<div class="footer">
    活动主办方:互亿无线&nbsp;&nbsp;
    技术支持:<a href="http://m.ihuyi.com/huodong.html">互亿无线</a>
</div>
</body>
</html>